/* import { createRoot } from 'react-dom/client';
import App from './App';
const rootElement = document.getElementById('root');
const root = createRoot(rootElement);
root.render(<App />); */
import { autorun, toJS } from 'mobx';
import { observable } from 'mobx';

let obj = { person: { name: 'zhufeng' } }
//它的每个属性也自动会变成代理对象
const proxyObj = observable(obj)
const { person } = proxyObj;
//可以通过 toJS把代理对象变成普通对象
const clonePerson = toJS(person)
autorun(() => {
  console.log(clonePerson.name);
  //因为我们的响应式逻辑是封头取值的时候的
});
proxyObj.person.name = '2'

//useContext包裹一层是啥作用呢
//通过 context可以从顶层级件跨层级传递数据